package com.ld.utils;

import java.util.regex.Pattern;

public class CommonUtils {
    public static boolean isMatch(String pat, String v) {
        Pattern pattern = Pattern.compile(pat);
        int length = v.length();
        if (length == 0) return false;
        if (length == 1){
            return pattern.matcher(v).matches();
        }
        for (int i=0;i<length;i++){
            String s = String.valueOf(v.charAt(i));
            if (s.trim().length() <= 0) continue;
            if (!pattern.matcher(s).matches()){
                return false;
            }
        }
        return true;
    }
}
